const express = require('express');
const router = express.Router();

// 获取欢迎信息
router.get('/', (req, res) => {
  res.json({
    success: true,
    data: {
      message: '欢迎使用 WhatToEat API',
      version: '1.0.0',
      description: '随机选择餐厅的API服务'
    },
    message: '欢迎使用 WhatToEat API'
  });
});

// 健康检查
router.get('/health', (req, res) => {
  const uptime = process.uptime();
  res.json({
    success: true,
    data: {
      status: 'ok',
      timestamp: new Date().toISOString(),
      uptime: uptime,
      environment: process.env.NODE_ENV || 'development',
      version: '1.0.0'
    },
    message: '服务运行正常'
  });
});

// 获取应用信息
router.get('/info', (req, res) => {
  res.json({
    success: true,
    data: {
      name: 'WhatToEat API',
      version: '1.0.0',
      description: '随机选择餐厅的API服务',
      author: 'WhatToEat Team',
      endpoints: {
        restaurants: '/api/restaurants',
        draw: '/api/draw',
        marks: '/api/marks'
      }
    },
    message: '应用信息获取成功'
  });
});

module.exports = router;